package com.luoran.car.domain;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 优惠券表
 * @TableName sys_car_coupon
 */
@TableName(value ="sys_car_coupon")
@Data
public class SysCarCoupon implements Serializable {
    /**
     * 优惠券唯一标识
     */
    @TableId(type = IdType.AUTO)
    private Integer couponId;

    /**
     * 优惠券标题
     */
    private String title;

    /**
     * 优惠券描述信息
     */
    private String description;

    /**
     * 折扣类型，如固定金额、百分比等
     */
    private Integer discountType;

    /**
     * 折扣具体数值
     */
    private BigDecimal discountValue;

    /**
     * 优惠券开始日期
     */
    private Date startDate;

    /**
     * 优惠券结束日期
     */
    private Date endDate;

    /**
     * 优惠券总数量
     */
    private Integer totalQuantity;

    /**
     * 已领取数量
     */
    private Integer claimedQuantity;

    /**
     * 优惠券是否有效
     */
    private Integer isActive;

    /**
     * 优惠券图片存储路径
     */
    private String pic;

    /**
     * 满减具体值
     */
    private BigDecimal diminutionValue;

    /**
     * 直减金额
     */
    private BigDecimal lapseValue;

    /**
     * 删除标识
     */
    @TableLogic
    private Integer deleteFlag;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysCarCoupon other = (SysCarCoupon) that;
        return (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType()))
            && (this.getDiscountValue() == null ? other.getDiscountValue() == null : this.getDiscountValue().equals(other.getDiscountValue()))
            && (this.getTotalQuantity() == null ? other.getTotalQuantity() == null : this.getTotalQuantity().equals(other.getTotalQuantity()))
            && (this.getClaimedQuantity() == null ? other.getClaimedQuantity() == null : this.getClaimedQuantity().equals(other.getClaimedQuantity()))
            && (this.getIsActive() == null ? other.getIsActive() == null : this.getIsActive().equals(other.getIsActive()))
            && (this.getPic() == null ? other.getPic() == null : this.getPic().equals(other.getPic()))
            && (this.getDiminutionValue() == null ? other.getDiminutionValue() == null : this.getDiminutionValue().equals(other.getDiminutionValue()))
            && (this.getLapseValue() == null ? other.getLapseValue() == null : this.getLapseValue().equals(other.getLapseValue()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode());
        result = prime * result + ((getDiscountValue() == null) ? 0 : getDiscountValue().hashCode());
        result = prime * result + ((getTotalQuantity() == null) ? 0 : getTotalQuantity().hashCode());
        result = prime * result + ((getClaimedQuantity() == null) ? 0 : getClaimedQuantity().hashCode());
        result = prime * result + ((getIsActive() == null) ? 0 : getIsActive().hashCode());
        result = prime * result + ((getPic() == null) ? 0 : getPic().hashCode());
        result = prime * result + ((getDiminutionValue() == null) ? 0 : getDiminutionValue().hashCode());
        result = prime * result + ((getLapseValue() == null) ? 0 : getLapseValue().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", couponId=").append(couponId);
        sb.append(", title=").append(title);
        sb.append(", description=").append(description);
        sb.append(", discountType=").append(discountType);
        sb.append(", discountValue=").append(discountValue);
        sb.append(", totalQuantity=").append(totalQuantity);
        sb.append(", claimedQuantity=").append(claimedQuantity);
        sb.append(", isActive=").append(isActive);
        sb.append(", pic=").append(pic);
        sb.append(", diminutionValue=").append(diminutionValue);
        sb.append(", lapseValue=").append(lapseValue);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
